use serde::Deserialize;
use serde_aux::field_attributes::deserialize_number_from_string;

#[derive(Debug, Deserialize)]
pub struct AppSettings {
    host: String,
    #[serde(deserialize_with = "deserialize_number_from_string")]
    port: u16,
}

impl AppSettings {
    pub fn listening_addr(&self) -> String {
        format!("{}:{}", self.host, self.port)
    }
}
